package com.zzj.hotel.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zzj.hotel.core.entity.Picture;
import com.zzj.hotel.dao.PictureDao;
import com.zzj.hotel.service.PictureService;

public class PictureServiceImpl implements PictureService {
	private PictureDao PictureDao;

	public PictureDao getPictureDao() {
		return PictureDao;
	}

	public void setPictureDao(PictureDao PictureDao) {
		this.PictureDao = PictureDao;
	}

	public Picture findById(String id) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put(Picture.PICTURE_ID, id);
		return PictureDao.selectOne(queryMap);
	}

	public List<Picture> findAll() {
		return PictureDao.selectList(null);
	}

	public List<Picture> findList(String id, int flag) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		if(flag == 0){
			queryMap.put(Picture.PICTURE_ARTICLEID, id);
		}
		if(flag == 1){
			queryMap.put(Picture.PICTURE_CLASSIFYID, id);
		}
		return PictureDao.selectList(queryMap);
	}

	public void deletePicture(String PictureId) {
		PictureDao.deleteById(PictureId);
	}

	public void addPicture(Picture Picture) {
		PictureDao.insert(Picture);
	}

	public void updatePicture(Picture Picture) {
		PictureDao.update(Picture);
	}

	public Picture findById(String id, int flag) {
		// TODO Auto-generated method stub
		return null;
	}
}
